package cn.jbit.domain;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 财龙
 * @Description:
 * @date 2020/9/29 9:21
 */
public class Message {
    private int code;//状态码
    private String msg;//信息
            private Map<String,Object> extend=new HashMap<>();//数据

    //成功
    public static  Message success(){
        Message message=new Message();
        message.setCode(200);
        message.setMsg("响应成功");
        return message;
    }
    //失败
    public  static Message fail(){
        Message message=new Message();
        message.setCode(500);
        message.setMsg("响应失败");
        return message;
    }
    //添加数据的方法
    public Message add(String key,Object value){
        this.getExtend().put(key,value);
        return this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Map<String, Object> getExtend() {
        return extend;
    }

    public void setExtend(Map<String, Object> extend) {
        this.extend = extend;
    }
}
